﻿Public Class CSBitEvento

Private _IdRegistro     As Long 
Private _CveEvento      As Integer 
Private _IdUsuFrida     As Integer
Private _Descripcion    As String 




 Public Sub new(ByVal CveEvento As Integer, ByVal IdUsuarioFrida As Integer, ByVal Descripcion As String) 
  
     _CveEvento   = CveEvento 
     _IdUsuFrida  = IdUsuarioFrida

     
     _Descripcion =  CUtileria.PrepararCadenaParaSQL(Descripcion,__MAXLONGITUDMSG__)

         
    
     _IdRegistro  =  CServicioLocalSQLServerDB.ObtenerIdRegEventoDB () 

 End Sub
 
 Public Sub new(ByVal CveEvento As Integer, ByVal IdUsuarioFrida As Integer) 
  
     _CveEvento   = CveEvento 
     _IdUsuFrida  = IdUsuarioFrida
     _Descripcion = ""

     _IdRegistro  =  CServicioLocalSQLServerDB.ObtenerIdRegEventoDB () 

 End Sub


Public ReadOnly  Property IdRegistro() As Long 
    Get
        Return _IdRegistro
    End Get    
End Property

Public ReadOnly  Property CveEvento() As Integer 
    Get
        Return _CveEvento
    End Get    
End Property

Public ReadOnly  Property IdUsuFrida() As Integer 
    Get
        Return _IdUsuFrida
    End Get    
End Property

Public Property Descripcion() As String
    Get
        Return _Descripcion 
    End Get
    Set(ByVal value As String)
        _Descripcion = value
    End Set
End Property



Public sub GuadarDetalle(ByVal Campo As String, ByVal Valor As String)  
   CServicioLocalSQLServerDB.GuardarDetalleEventoBit (_IdRegistro,Campo , CUtileria.PrepararCadenaParaSQL (  Valor,__MAXLONGITUDMSG__) )   
End Sub

Public Sub GuardarDetalles(ByRef lstDetalles As List(Of  CTBitEventoDet ))
    If lstDetalles.Count() > 0 Then
        CServicioLocalSQLServerDB.GuardarDetallesEventoBit (_IdRegistro,lstDetalles)  
    End If
End Sub

Public Sub ActualizarFechaFinDelEvento() 
  CServicioLocalSQLServerDB.ActualizarEventoBit (_IdRegistro ) 
End Sub

Public Function  GuardarError(ByVal Mensaje As String) As CSBitError


      
  Dim nvoError = New CSBitError (_IdRegistro,CUtileria.PrepararCadenaParaSQL(Mensaje,__MAXLONGITUDMSG__))    
  CServicioLocalSQLServerDB.GuardarErrorBit (nvoError) 

  Return nvoError 

End Function

End Class


Public Class CTBitEventoDet


Private _Campo    As String 
Private _Valor    As String 


Public Sub new( ByVal Campo As String, ByVal Valor As String)
  _Campo     = Campo 
  
  If Valor.Length > __MAXLONGITUDMSG__ then 
       _Valor = Valor.Substring(0, __MAXLONGITUDMSG__-1)  
  else
      _valor = valor 
  End If
  _Valor     = Valor 
End Sub



Public  ReadOnly  Property  Campo() As String 
    Get
        Return _Campo 
    End Get
End Property


Public  ReadOnly  Property  Valor() As String 
    Get
        Return _Valor 
    End Get
End Property



End Class